﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace Struct
{
    // 接受参数用的结构体 详情见：https://learn.microsoft.com/zh-CN/windows/win32/api/winuser/ns-winuser-guithreadinfo
    [StructLayout(LayoutKind.Sequential)]
    public struct GUITHREADINFO
    {
        public int cbSize;
        public int flags;
        public IntPtr hwndActive;
        public IntPtr hwndFocus;
        public IntPtr hwndCapture;
        public IntPtr hwndMenuOwner;
        public IntPtr hwndMoveSize;
        public IntPtr hwndCaret;
        public RECT rectCaret;

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("{");
            sb.Append("\"cbSize\":"); sb.Append(cbSize.ToString()); sb.Append(",");
            sb.Append("\"flags\":"); sb.Append(cbSize.ToString()); sb.Append(",");
            sb.Append("\"hwndActive\":"); sb.Append(cbSize.ToString()); sb.Append(",");
            sb.Append("\"hwndFocus\":"); sb.Append(cbSize.ToString()); sb.Append(",");
            sb.Append("\"hwndCapture\":"); sb.Append(cbSize.ToString()); sb.Append(",");
            sb.Append("\"hwndMenuOwner\":"); sb.Append(cbSize.ToString()); sb.Append(",");
            sb.Append("\"hwndMoveSize\":"); sb.Append(cbSize.ToString()); sb.Append(",");
            sb.Append("\"hwndCaret\":"); sb.Append(cbSize.ToString()); sb.Append(",");
            sb.Append("\"rectCaret\":"); sb.Append(rectCaret.ToString()); sb.Append(",");
            sb.Append("}");
            return sb.ToString();
        }
    }
}
